import 'package:flutter/material.dart';
import 'package:getx_scaffold/getx_scaffold.dart';
import 'package:oramemo/generated/assets.dart';
import 'package:oramemo/pages/facility/blue/blue_logic.dart';
import 'package:oramemo/pages/facility/facility_router.dart';

class CheckVolView extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: Get.width,
      margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 12.h),
      padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 12.h),
      decoration: ShapeDecoration(
        color: const Color(0xFFF3F5F9),
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(36.r),
        ),
      ),
      child:InkWell(
        onTap: () {
          BlueLogic logic = Get.find();

          final bool isBleConnected = logic.connectedDevice.value !=
              null;
          if(isBleConnected) {
            Get.toNamed(FacilityRouter.blueSettingPage);
          }else{
            Toast.show('请先连接蓝牙');
          }
        },
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            SizedBox(height: 15.h),
            Row(
              children: [
                Text(
                  '听力验配',
                  textAlign: TextAlign.center,
                  style: TextStyle(
                    color: Color(0xFF303030),
                    fontSize: 24.sp,
                    fontFamily: 'Inter',
                    fontWeight: FontWeight.w400,
                  ),
                ),
              ],
            ),
            SizedBox(height: 3.h),
            SizedBox(
              width: 116.w,
              child: SizedBox(
                width: 116.w,
                child: Text(
                  '检测听力受损情况',
                  textAlign: TextAlign.center,
                  style: TextStyle(
                    color: Color(0xFF979797),
                    fontSize: 14.sp,
                    fontFamily: 'Inter',
                    fontWeight: FontWeight.w400,
                  ),
                ),
              ),
            ),
            Container(
              width: 220.w,
              height: 112.27.h,
              alignment: Alignment.centerRight,
              child: ImageX(type: ImageType.asset, image: Assets.homeLive),
            ),
          ],
        ),
      ),
    );
  }
}